/*-------------------------------------------------------------------------
 *
 * indexing.h
 *	  此文件提供了一些定义，以支持对系统目录的索引。
 *
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/catalog/indexing.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef INDEXING_H
#define INDEXING_H

#include "access/htup.h"
#include "nodes/execnodes.h"
#include "utils/relcache.h"

/*
 * CatalogOpenIndexes 等使用的状态对象实际上与执行器的 ResultRelInfo
 * 是相同的，但我们给它另一个类型名称以使调用者与此事实解耦。
 */
typedef struct ResultRelInfo *CatalogIndexState;

/*
 * 限制为系统目录分配的多重插入的最大字节数，
 * 限制使用的槽位数。
 */
#define MAX_CATALOG_MULTI_INSERT_BYTES 65535

/*
 * indexing.c 原型
 */
extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
extern void CatalogCloseIndexes(CatalogIndexState indstate);
extern void CatalogTupleInsert(Relation heapRel, HeapTuple tup);
extern void CatalogTupleInsertWithInfo(Relation heapRel, HeapTuple tup,
									   CatalogIndexState indstate);
extern void CatalogTuplesMultiInsertWithInfo(Relation heapRel,
											 TupleTableSlot **slot,
											 int ntuples,
											 CatalogIndexState indstate);
extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid,
							   HeapTuple tup);
extern void CatalogTupleUpdateWithInfo(Relation heapRel,
									   ItemPointer otid, HeapTuple tup,
									   CatalogIndexState indstate);
extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid);

#endif							/* INDEXING_H */
